package com.chao.yyks.modular.sys.controller;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.log.Inter;
import com.chao.common.util.reaction.PageList;
import com.chao.yyks.modular.sys.bean.EnClasss;
import com.chao.yyks.modular.sys.bean.EnClasssType;
import com.chao.yyks.modular.sys.service.EnClasssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * 班级Controller
 * chao
 * 2024-09-09
 */
@RestController
@RequestMapping("/enClasss")
public class EnClasssController {

	/**
	 * 班级Service
	 */
	@Autowired
	private EnClasssService enClasssService;

	/**
	 * 新增班级
	 */
	@Inter("ECS_ADD_01")
	@RequestMapping(method = RequestMethod.POST, value = "insertEnClasss")
	public void insertEnClasss(@RequestBody EnClasss enClasss){
		enClasssService.insertEnClasss(enClasss);
	}

	/**
	 * 修改班级
	 */
	@Inter("ECS_EDT_01")
	@RequestMapping(method = RequestMethod.POST, value = "updateEnClasss")
	public void updateEnClasss(@RequestBody EnClasss enClasss){
		enClasssService.updateEnClasss(enClasss);
	}

	/**
	 * 物理删除班级
	 */
	@Inter("ECS_DEL_02")
	@RequestMapping(method = RequestMethod.POST, value = "deleteDataEnClasss")
	public void deleteDataEnClasss(@RequestBody EnClasss enClasss){
		enClasssService.deleteDataEnClasss(enClasss.getClasssId());
	}

	/**
	 * 查询班级详情
	 */
	@Inter("ECS_SEL_01")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnClasssByClasssId")
	public EnClasss selectEnClasssByClasssId(String classsId){
		return enClasssService.selectEnClasssByClasssId(classsId);
	}

	/**
	 * 查询班级列表
	 */
	@Inter("ECS_SEL_02")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnClasssByList")
	public PageList<EnClasss> selectEnClasssByList(@RequestParam Map<String,Object> map){
		return enClasssService.selectEnClasssByList(new JSONObject(map));
	}

	/**
	 * 分页查询班级列表
	 */
	@Inter("ECS_SEL_03")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnClasssByPage")
	public PageList<EnClasss> selectEnClasssByPage(@RequestParam Map<String,Object> map){
		return enClasssService.selectEnClasssByPage(new JSONObject(map));
	}

}